package com.lovo.classinfo;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import com.lovo.netCRM.component.LovoButton;
import com.lovo.netCRM.component.LovoComboBox;
import com.lovo.netCRM.component.LovoDate;
import com.lovo.netCRM.component.LovoFileChooser;
import com.lovo.netCRM.component.LovoLabel;
import com.lovo.netCRM.component.LovoRadioButton;
import com.lovo.netCRM.component.LovoTitleLabel;
import com.lovo.netCRM.component.LovoTxt;
import com.lovo.netCRM.component.LovoTxtArea;


/**
 * 班级修改对话框
 * @author 白德柯
 *
 */
public class ClassUpdateDialog extends JDialog{

	/**班级名称标签*/
	private LovoLabel nameLabel = new LovoLabel("班级名称",40,90,this);
	/**带班老师文本框*/
	private LovoTxt teacherTxt = new LovoTxt("带班老师",40,130,this);
	/**班级主面板*/
	private ClassPanel classPanel;
	/**班级id*/
	private int id;
	
	public ClassUpdateDialog(JFrame jf,int id,ClassPanel classPanel){
		super(jf,true);
		this.classPanel = classPanel;
		this.id = id;
		this.setLayout(null);
		this.setTitle("班级修改");
		this.init();
		
		Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
		int x = (int) screensize.getWidth() / 2 - 190;
		int y = (int) screensize.getHeight() / 2 - 240;
		this.setBounds(x, y, 380, 280);
		this.setVisible(true);
	}
	/**
	 * 初始化
	 *
	 */
	private void init(){
		LovoTitleLabel titleLabel = new LovoTitleLabel("班级修改",this);
		titleLabel.setLocation(120, titleLabel.getY());
		this.initData(id);
		LovoButton updateButton = new LovoButton(120,170,"修改","image/update.png",this);
		updateButton.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e) {
				boolean isOk = update();
				if(isOk){
					ClassUpdateDialog.this.dispose();
				}
			}});
		
	}
	/**
	 * 初始化数据
	 * @param id
	 */
	private void initData(int id){
		
	}
	/**
	 * 修改操作
	 *
	 */
	private boolean update(){
		return true;
	}

}
